﻿@model PerformanceModel
@{
    ViewBag.Title = Model.Title;
    var shareModel = ViewBag.JsApiSignature as Dictionary<string, string>;
}

<section id="cover">
    <img id="cover-img" src="@Url.Content("~/" + Model.ImageUrl)"/>
    <div id="date"> @Html.Raw(Model.ShowTime.ToString("M月<br/>d日")) </div>
</section>
<section id="body">
    <p id="title">@Model.Title</p>
    <p id="sub-title">
        地址：@Model.Address @Model.ShowTime.ToString("M月d日 HH:mm")
        <button id="share-btn">分 享</button>
    </p>
    <article> @Html.Raw(Model.Content)</article>
    @if (!string.IsNullOrEmpty(Model.Video))
    {
        <p id="video" style="text-align:center">
            <video src="@Model.Video" controls="" style="width: 80%"></video>
        </p>
    }
</section>



@section css{
    <style>
        #cover {
            position: relative;
            width: 100%;
        }
        #cover-img {
            width: 100%;
        }
        #date {
            background-image: url('/Assets/bg_date.png');
            background-size: 100% 100%;
            background-repeat: no-repeat;
            width: 60px;
            height: 80px;
            color: white;
            position: absolute;
            top: 5px;
            right: 15px;
            text-align: center;
            padding-top: 10px;
            font-size: 15px;
        }
        #body {
            margin: 15px 20px;
        }
        #title {
            font-size: 18px;
            margin: 0;
        }
        #sub-title {
            margin: 5px 0;
        }
        #share-btn {
            float: right;
            color: white;
            padding: 2px 15px;
            background: #2f4f4f;
            border: 1px solid grey;
            border-radius: 4px;
        }
        article p {
            text-indent: 2em;
        }
    </style>
}

@section scripts{
    <script src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script src="~/Scripts/weixin.js"></script>
    <script type="text/javascript">
        var wxConfig = {
            debug: true,
            appId: '@shareModel["appId"]',
            nonceStr: '@shareModel["noncestr"]',
            jsapi_ticket: '@shareModel["jsapi_ticket"]',
            timestamp: @shareModel["timestamp"],
            signature:'@shareModel["signature"]',
            jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage']
        };

        WeixinHelper.init(wxConfig);

        WeixinHelper.share('share-btn', '@Model.Title', '@Request.Url.ToString()', '@Model.Thumb',
            function() {
                alert('分享成功');
            });
    </script>
}